Inside Macintosh: Macintosh Toolbox Essentials

Previous | Chapter Top | Chapter Contents | Next

The Target ID Structure

When you send a high-level event to another application, you can use a target ID structure to specify the recipient of the event. When you receive a high-level event, the AcceptHighLevelEvent function (AcceptHighLevelEvent) uses a target ID structure to return information about the sender of the event.

A target ID structure is defined by a structure of type TargetID .

struct TargetID {                       /* target ID structure */
    long                sessionID;      /* session reference number */
    PPCPortRec          name;           /* port name */
    LocationNameRec     location;       /* location name */
    PPCPortRec          recvrName;      /* reserved */
    };
typedef struct TargetID TargetID;
typedef TargetID *TargetIDPtr, **TargetIDHandle, **TargetIDHdl;
sessionID
For high-level events that your application receives, this field contains the session reference number created by the PPC Toolbox. This is a 32-bit number that uniquely identifies a PPC Toolbox session (or connection) with another application. This field is not used by your application when sending a high-level event to another process. (To send a high-level event that specifies the recipient by session reference number, provide a pointer to a session reference number in the receiverID parameter and use the receiverIDisSessionID constant in the postingOptions parameter to PostHighLevelEvent (PostHighLevelEvent) .)
name
For high-level events that your application receives, this field contains a PPC port record that specifies the port name of the process from which the high-level event originated. When sending a high-level event to a process on a local or remote computer, you can specify the port name of the recipient process in a PPC port record that you provide in this field.
If the sending application is on the same computer as the receiving application, you can determine the sending application's process serial number by calling the GetProcessSerialNumberFromPortName function (GetProcessSerialNumberFromPortName) .
location
For high-level events that your application receives, this field contains a location name record that identifies the location name of the process from which the high-level event originated. When sending a high-level event to a process on a local or remote computer, you can specify the location name of the recipient process in a location name record that you provide in this field.
recvrName
This field is reserved.

© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next